.TH std::atomic_flag::test_and_set 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::atomic_flag::test_and_set \- std::atomic_flag::test_and_set

.SH Synopsis
   Defined in header <atomic>
   bool test_and_set( std::memory_order order =
                          std::memory_order_seq_cst ) volatile        \fB(1)\fP \fI(since C++11)\fP
   noexcept;
   bool test_and_set( std::memory_order order =                       \fB(2)\fP \fI(since C++11)\fP
                          std::memory_order_seq_cst ) noexcept;

   Atomically changes the state of a std::atomic_flag to set (true) and returns the
   value it held before.

.SH Parameters

   order - the memory synchronization order

.SH See also

   clear                             atomically sets flag to false
                                     \fI(public member function)\fP
   atomic_flag_test_and_set          atomically sets the flag to true and returns its
   atomic_flag_test_and_set_explicit previous value
   \fI(C++11)\fP                           \fI(function)\fP
   \fI(C++11)\fP
   memory_order                      defines memory ordering constraints for the given
   \fI(C++11)\fP                           atomic operation
                                     \fI(enum)\fP
